package com.hyt.it.ogt.ks.config;

import java.util.ArrayList;
import java.util.List;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.convert.converter.Converter;
import org.springframework.data.mongodb.core.convert.CustomConversions;

import com.hyt.it.ogt.ks.util.LocalDateTimeToMongodb;
import com.hyt.it.ogt.ks.util.MongodbToLocalDateTime;

/**
 * @author wuyingge
 * @ClassName MongoConfig.java
 * @Description 注册mongodb iso date to java localDateTime转换器
 * @createTime 2021年11月12日 18:04:00
 */
@Configuration
public class MongoConfig {

    @Bean
    public CustomConversions customConversions(){
        List<Converter<?, ?>> converterList = new ArrayList<>();
        converterList.add(new LocalDateTimeToMongodb());
        converterList.add(new MongodbToLocalDateTime());
        return new CustomConversions(converterList);
    }
}
